const {Sequelize} = require("sequelize");

/**
 * 开始连接
 * 
 */

console.log("开始连接");

const sequelize = new Sequelize({
  dialect:"mysql",
  database:"learn-sequelize",
  username:"root",
  password:"413606095",
  host:"182.92.229.9",
  port:'3306',
  timezone:"+08:00",
  dialectOptions:{
    useUTC:false
  }
});

const start = async()=>{
  try{
    await sequelize.authenticate();
    // console.log("Connection has been established successfully.");
    console.log("连接成功");
    return sequelize;
  }catch(error){
    console.error("无法连接:",error);
  }
}


module.exports = start;



